home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / tex / tools / umrand / umranda.mf < prev    next >
Encoding:
Text File  |  1994-09-22  |  15.0 KB  |  478 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % A font of the border-project       %
  3. % This file has version number 1.2.  %
  4. % 19.06.1993                         %
  5. % (c) by Andreas Schrell, Wuppertal  %
  6. %    and Andreas H"orstemeier, Hemer %
  7. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8.  
  9. input umrand
  10.  
  11. def wood(expr W) =
  12.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  13.         pickup pencircle scaled penwid;
  14.         xscal:=1;
  15.         u:=w/10; v:=h/20;
  16.         x0=x1=0;
  17.         x2=x3=x4=x5=x6=u;
  18.         x7=x8=x9=x10=x11=x12=2u;
  19.         x13=x14=x15=3u;
  20.         x16=x17=x18=x19=4u;
  21.         x20=x21=x22=5u;
  22.         x23=x24=x25=6u;
  23.         x26=7u;  x27=8u;
  24.         x28=x29=10u;
  25.         y2=20v;     y0=19v;     y3=16v;
  26.         y7=y16=15v; y13=y20=14v;
  27.         y8=13v;     y21=12v;
  28.         y9=y17=y23=y27=y28=11v;
  29.         y4=y14=y26=10v;
  30.         y18=y24=y29=9v;
  31.         y5=8v;      y10=y19=y25=7v;
  32.         y15=y22=6v;
  33.         y11=5v;     y12=3v;     y1=v;       y6=0v;
  34.         CenterRot(W);
  35.         if abs(abs(sind(W))-abs(cosd(W))) < eps:
  36.             currenttransform := identity shifted(2u,0) 
  37.                                     transformed (currenttransform);
  38.         fi
  39.         draw z2--z0--z1--z6--z5--z15;
  40.         draw z10--z12--z22--z19--z11;
  41.         draw z0--z16--z8--z7--z13;
  42.         draw z7--z3--z4--z9--z8;
  43.         draw z4--z19--z18--z9--z20--z21--z14;
  44.         draw z17--z18;
  45.         draw z21--z22--z25--z24--z23--z21;
  46.         draw z23--z26--z24;
  47.         draw z20--z27--z26;
  48.         draw z2--z28--z25;
  49.         draw z28--z29--z6;
  50.     endchar;
  51. enddef;
  52.  
  53. def yingyang(expr W) =
  54.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  55.         pickup pencircle scaled penwid;
  56.         xscal:=1;
  57.         CenterRot(W);
  58.         x1=w-x2=0; y1=y2=y5=0.5h;
  59.         y3=h-y4=0; x3=x4=x5=0.5w;
  60.         x8=y8=w-x7=w-y7=w/4;
  61.         draw (z1{down}..z3{right}..z2{up}..z4{left}..z1{down}--cycle);
  62.         turningcheck:=0;
  63.         fill (z3{right}..z2{up}..z7{left}..z5{down}
  64.                               ..z8{left}..z1{up}--z1{down}..z3{right}--cycle);
  65.         turningcheck:=2;
  66.         cullit;
  67.         fill (fullcircle scaled (w/6) shifted (w/4,h/2));
  68.         unfill (fullcircle scaled (w/6) shifted (w-w/4,h/2));
  69.     endchar;
  70. enddef;
  71.  
  72.  
  73. % nach Apollonio: Dynamische circulaire 5 H
  74.  
  75. def dynacirc(expr W,Lines) =
  76.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  77.         pw# := charsize#/(2.3*(Lines));
  78.         define_blacker_pixels(pw);
  79.         pickup pencircle scaled pw;
  80.         xscal:=1;
  81.         CenterRot(W);
  82.         for i=0 upto Lines:
  83.             penpos[i](pw,90);
  84.             x[i]=0.5w;
  85.             y[i]=i*h/Lines;
  86.         endfor;
  87.         penpos100(1,-40);   penpos101(1,-40);
  88.         x100=x101=0.5w;
  89.         top y100=y0;        bot y101=y[Lines];
  90.         for i=0 upto Lines:
  91.             penstroke (
  92.                 z[100].e{left}..z[i].e{right}..z[101].e{left});
  93.         endfor;
  94.     endchar;
  95. enddef;
  96.  
  97.  
  98. % nach Ludwig: Kinematische Scheibe
  99.  
  100. def kinemat(expr W,Lines) =
  101.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  102.         pa# := charsize#*3.14/3.5*2/Lines;
  103.         pi# := charsize#/7*3.14/3.5*2/Lines;
  104.         define_blacker_pixels(pa,pi);
  105.         xscal:=1;
  106.         CenterRot(W);
  107.         penpos0(pa,90);
  108.         penpos1(pi,90);
  109.         z0=(w,0.5h);
  110.         z1=(0.5w+0.06w,0.5h+0.08h);
  111.         for i=0 upto Lines:
  112.             penstroke CenterRotation(i*360/Lines,
  113.                 z0e--z1e);
  114.         endfor;
  115.     endchar;
  116. enddef;
  117.  
  118. def saw(expr W,Lines) =
  119.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  120.         pa# := charsize#*3.14/3*2/Lines;
  121.         pi# := charsize#/4*3.14/3*2/Lines;
  122.         define_blacker_pixels(pa,pi);
  123.         xscal:=1;
  124.         CenterRot(W);
  125.         penpos0(pi,90);
  126.         penpos1(pa,90);
  127.         z0=(w,0.5h);
  128.         z1=(0.5w+0.4w,0.5h+0.4h);
  129.         for i=0 upto Lines:
  130.             penstroke CenterRotation(i*360/Lines,
  131.                 z0e--z1e);
  132.         endfor;
  133.     endchar;
  134. enddef;
  135.  
  136. def opta(expr W) =
  137.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  138.         xscal:=1;
  139.         a := hround(w/8);
  140.         pickup pencircle scaled penwi;
  141.         for i=0 upto 5:
  142.             draw fullcircle scaled (w-i*a) shifted (0.5w,0.5h);
  143.         endfor;
  144.         pickup pencircle scaled penwid;
  145.         draw (w,h/2)--(w/2,h)--(0,h/2)--(w/2,0)--cycle;
  146.     endchar;
  147. enddef;
  148.  
  149. def optb(expr W) =
  150.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  151.         xscal:=1;
  152.         a := hround(w/8);
  153.         pickup pencircle scaled penwi;
  154.         for i=0 upto 5:
  155.             draw quartercircle scaled (w-i*a)
  156.                 rotated 0 shifted (0,0);
  157.             draw quartercircle scaled (w-i*a)
  158.                 rotated 90 shifted (w,0);
  159.             draw quartercircle scaled (w-i*a)
  160.                 rotated 180 shifted (w,h);
  161.             draw quartercircle scaled (w-i*a)
  162.                 rotated 270 shifted (0,h);
  163.         endfor;
  164.         pickup pencircle scaled penwid;
  165.         draw (w,h/2)--(w/2,h)--(0,h/2)--(w/2,0)--cycle;
  166.     endchar;
  167. enddef;
  168.  
  169. def kassette(expr W) =
  170.     if abs(abs(sind(W))-abs(cosd(W)))<eps:
  171.         fak:=sqrt(2)
  172.     else:
  173.         fak:=1
  174.     fi;
  175.     beginchar(incr nextchar,fak*charsize#,fak*charsize#,0cm#);
  176.         pickup pencircle scaled penwid;
  177.         xscal:=1;
  178.         CenterRot(W);
  179.         draw ((0,0)--(normw,0)--(normw,normh)--(0,normh)--cycle);
  180.         draw ((normw/4,normh)--(normw/4,normh/4)--(normw,normh/4));
  181.         draw 
  182.         ((normw/4,3normh/4)--(3normw/4,3normh/4)--(3normw/4,normh/4));
  183.         fill ((0,0)--(normw/3,0)--(normw/3,normh/3)--(0,normh/3)--cycle);
  184.     endchar;
  185. enddef;
  186.  
  187. def kassetteb(expr W) =
  188.     if abs(abs(sind(W))-abs(cosd(W)))<eps:
  189.         fak:=sqrt(2)
  190.     else:
  191.         fak:=1
  192.     fi;
  193.     beginchar(incr nextchar,fak*charsize#,fak*charsize#,0cm#);
  194.         pickup pencircle scaled penwid;
  195.         xscal:=1;
  196.         CenterRot(W);
  197.         draw ((0,0)--(normw,0)--(normw,normh)--(0,normh)--cycle);
  198.         draw ((normw/2,0)--(normw/2,normh/2)--(normw,normh/2));
  199.         draw ((0,normh/5)--(normw/2,normh/5));
  200.         draw ((4normw/5,normh)--(4normw/5,normh/2));
  201.         draw (unitsquare scaled (normw/5) shifted (0,4normh/5));
  202.         draw (unitsquare scaled (normw/3) shifted (0,2normh/3));
  203.         fill (unitsquare scaled (normw/3) shifted (2normw/3,0));
  204.     endchar;
  205. enddef;
  206.  
  207. def qq(expr W) =
  208.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  209.         xscal:=1;
  210.         pickup pencircle scaled penwid;
  211.         CenterRot(W);
  212.         draw (unitsquare scaled (w));
  213.         fill (unitsquare scaled (w/2) shifted (w/4,h/4));
  214.     endchar;
  215. enddef;
  216.  
  217. def oval(expr W) =
  218.     beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
  219.         pickup pencircle scaled penwid;
  220.         xscal:=2;
  221.         CenterRot(W);
  222.         draw (fullcircle xscaled (2normw) yscaled (normw)
  223.                               shifted (normw,normw/2));
  224.     endchar;
  225. enddef;
  226.  
  227. def teilquad(expr W) =
  228.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  229.         pickup pencircle scaled penwid;
  230.         xscal:=1;
  231.         CenterRot(W);
  232.         draw ((0,h)--(0,0)--(w,0)--(w,h));
  233.     endchar;
  234. enddef;
  235.  
  236. def gras(expr W) =
  237.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  238.         pickup pencircle scaled penwid;
  239.         xscal:=1;
  240.         CenterRot(W);
  241.         draw ((w/2,0){up}..{left}(0,h));
  242.         draw ((w/2,0){up}..{right}(w,h));
  243.         draw ((w/2,0){up}..{left}(0,2h/3));
  244.         draw ((w/2,0){up}..{right}(w,2h/3));
  245.     endchar;
  246. enddef;
  247.  
  248.  
  249. def fish(expr W,xs) =
  250.     beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
  251.         pickup pencircle scaled penwid;
  252.         path p;
  253.         xscal:=2;
  254.         CenterRot(W);
  255.         x0=0; x1=x2=2normw/3; x3=x4=2.3*3normw/4; x5=x6=2normw; x7=2*11normw/12;
  256.         y0=y7=normw/3; y1=normw; y2=y6=0; y4=normw/6; y5=2normw/3;
  257.         y3=normw/2; x8=normw/5; y8=y0;
  258.         p := z0{up}..z1{right}.. tension 1 and 1.2 ..z3..
  259.         tension 1.2 and 4 .. z5 ..tension 4 and 1
  260.         ..z7..
  261.         tension 1 and 4 .. z6 .. tension 4 and 1 ..z4..z2{left}..z0..cycle;
  262.         draw (CenterMirror(xs,1,p));
  263.         draw (CenterMirror(xs,1,z0{z2-z0}..z8));
  264.         pickup pencircle scaled penwidd;
  265.         drawdot (CenterMirror(xs,1,(normw/3,2normw/3.2)));
  266.     endchar;
  267. enddef;
  268.  
  269. def xlines(expr W) =
  270.     beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
  271.         pickup pencircle scaled penwid;
  272.         xscal:=2;
  273.         CenterRot(W);
  274.         draw ((0,0){right}..{right}(2normw,normw));
  275.         draw ((0,normw){right}..{right}(2normw,0));
  276.     endchar;
  277. enddef;
  278.  
  279. def xcirc(expr W) =
  280.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  281.         pickup pencircle scaled penwid;
  282.         xscal:=1;
  283.         CenterRot(W);
  284.         draw (fullcircle scaled w shifted (w/2,h/2));
  285.     endchar;
  286. enddef;
  287.  
  288. def xquad(expr W) =
  289.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  290.         pickup pencircle scaled penwid;
  291.         xscal:=1;
  292.         CenterRot(W);
  293.         draw (unitsquare scaled w);
  294.     endchar;
  295. enddef;
  296.  
  297. def xbcirc(expr W) =
  298.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  299.         pickup pencircle scaled penwid;
  300.         xscal:=1;
  301.         CenterRot(W);
  302.         draw (fullcircle scaled (sqrt(2)*w) shifted (w/2,h/2));
  303.     endchar;
  304. enddef;
  305.  
  306. def flower(expr W,xs) =
  307.     beginchar(incr nextchar,charsize#,charsize#,0cm#);
  308.         pickup pencircle scaled penwid;
  309.         gr := w/9*0.9; kr := w/12*0.9;
  310.         z0=(2kr+gr,h-2kr-gr); z1=(w-2kr-gr,2kr+gr);
  311.         xscal:=1;
  312.         CenterRot(W);
  313.         fill (
  314.             CenterMirror(xs,1,fullcircle scaled (2gr) shifted z0));
  315.         for l:=0 upto 8-1:
  316.             draw (
  317.                 CenterMirror(xs,1,
  318.                 fullcircle scaled (2kr) shifted (gr+kr,0)
  319.                            rotated (l*360/8) shifted z0));
  320.         endfor;
  321.         pwd# := 3penwid#;
  322.         define_blacker_pixels(pwd);
  323.         if write_white_engine:
  324.             pwd:=max(pwd,2);
  325.         fi;
  326.         draw (
  327.             CenterMirror(xs,1,(z0+(gr,0)){dir (-360/8)}..{right}(w,0)));
  328.         z3 = (0.9w,0);
  329.         z4 = z3+(-0.3w,0.6w);
  330.         z6 = z3+(-0.2w,0.3w);
  331.         z5 = z3+(-0.7w,0.3w);
  332.         z7 = z3+(-0.35w,0.2w);
  333.         penpos3(1,0); penpos4(1,45); penpos5(1,60);
  334.         penpos6(pwd,45); penpos7(pwd,60);
  335.         penstroke (
  336.             CenterMirror(xs,1,z3e..z6e..z4e));
  337.         penstroke (
  338.             CenterMirror(xs,1,z3e..z7e..z5e));
  339.     endchar;
  340. enddef;
  341.  
  342. def snake(expr W,xs) =
  343.     beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
  344.         pickup pencircle scaled penwid;
  345.         xscal:=2;
  346.         CenterRot(W);
  347.         u:=2normw/100; v:=normw/43;
  348.         def MYTR(expr a) = (CenterMirror(xs,1,a)) enddef;
  349.           x0=24u; x1=26u; x2=34u; x3=46u; x4=54u; x5=65u; x6=74u;
  350.         x7=86u; x8=95u; x9=100u; x17=11u;
  351.         x10=21u; x11=16u; x12=12u; x13=9u; x14=18.5u; x15=4u; x16=6u;
  352.         y0=34v; y1=15v; y2=5v; y3=18v; y4=30v; y5=13v; y6=3v;
  353.         y7=13v; y8=14v; y9=11v; y17=37v;
  354.         y10=39v; y11=38v; y12=35v; y13=33v; y14=39v; y15=29v; y16=30v;
  355.         penpos0(8u,20); penpos1(8u,30); penpos2(7.5u,87); penpos3(7u,130);
  356.         penpos4(7u,90); penpos5(6.5u,43); penpos6(6u,87); penpos7(5u,130);
  357.         penpos8(3u,80); penpos9(1,45);
  358.         penpos10(8u,70); penpos11(8u,100); penpos12(11u,130);
  359.         penpos13(9u,130); penpos14(8u,90); penpos15(1,135); penpos16(4u,135);
  360.         penstroke MYTR(
  361.             z15e..z16e..z13e..z12e..z11e..z14e..z10e
  362.             ..z0e..z1e..z2e..z3e..z4e..z5e..z6e..z7e..z8e..z9e);
  363.         cullit;
  364.         unfill MYTR(z13--z16l..z15l..z15r..
  365.                         z16r--z13--cycle);
  366.         draw MYTR(z13{(-1,-1)}..(0,26v));
  367.         draw MYTR(z13{(-1,-1)}..(2.5u,24v));
  368.         pickup pencircle scaled penwidd;
  369.         undrawdot(MYTR(z17));
  370.     endchar;
  371. enddef;
  372.  
  373. nextchar:=-1; % -1: we start first char width incr(-1) = 0!
  374.  
  375. for k=0 upto 8-1: wood(k*360/8); endfor;
  376.  
  377. for k=0 upto 12-1: yingyang(k*360/12); endfor;
  378.  
  379. for k=0 upto 6-1: dynacirc(k*180/6,13); endfor;
  380.  
  381. for k=0 upto 6-1: dynacirc(k*180/6,8); endfor;
  382.  
  383. kinemat(0,35);
  384.  
  385. saw(0,8);
  386.  
  387. opta(0);
  388.  
  389. optb(0);
  390.  
  391. for k=0 upto 8-1: kassette(k*360/8); endfor;
  392.  
  393. for k=0 upto 8-1: kassetteb(k*360/8); endfor;
  394.  
  395. qq(0);
  396.  
  397. for k=0 upto 4-1: oval(k*180/4); endfor;
  398.  
  399. for k=0 upto 4-1: teilquad(k*360/4); endfor;
  400.  
  401. for k=0 upto 4-1: gras(k*360/4); endfor;
  402.  
  403. for k=0 upto 4-1: fish(k*360/4,1); fish(k*360/4,-1); endfor;
  404.  
  405. xlines(0); xlines(90); xcirc(0); xquad(0); xbcirc(0);
  406.  
  407. for k=0 upto 4-1: flower(k*360/4,1); flower(k*360/4,-1); endfor;
  408.  
  409. for k=0 upto 4-1: snake(k*360/4,1); snake(k*360/4,-1); endfor;
  410.  
  411.  
  412. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  413.         xscal:=1;
  414.         CenterRot(0);
  415.         pickup pencircle scaled penwid;
  416.         sec(5);
  417.         draw (.5u,0)--(.5u,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,.5v)--(5u,.5v);
  418. endchar;
  419.  
  420. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  421.         xscal:=1;
  422.         CenterRot(0);
  423.         pickup pencircle scaled penwid;
  424.         sec(5);
  425.         draw (0,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,.5v)--(5u,.5v);
  426. endchar;
  427.  
  428. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  429.         xscal:=1;
  430.         CenterRot(0);
  431.         pickup pencircle scaled penwid;
  432.         sec(5);
  433.         draw (0,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,0);
  434. endchar;
  435.  
  436. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  437.         xscal:=1;
  438.         CenterRot(0);
  439.         pickup pencircle scaled penwid;
  440.         sec(5);
  441.         draw (4.5u,5v)--(4.5u,4.5v)--(.5u,4.5v)--(.5u,.5v)--(3.5u,.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(1.5u,1.5v)--(1.5u,3.5v)--(4.5u,3.5v)--(4.5u,0);
  442. endchar;
  443.  
  444. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  445.         xscal:=1;
  446.         CenterRot(0);
  447.         pickup pencircle scaled penwid;
  448.         sec(5);
  449.         draw (4.5u,5v)--(4.5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,4.5v)--(0,4.5v);
  450. endchar;
  451.  
  452. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  453.         xscal:=1;
  454.         CenterRot(0);
  455.         pickup pencircle scaled penwid;
  456.         sec(5);
  457.         draw (5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,4.5v)--(0,4.5v);
  458. endchar;
  459.  
  460. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  461.         xscal:=1;
  462.         CenterRot(0);
  463.         pickup pencircle scaled penwid;
  464.         sec(5);
  465.         draw (5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,5v);
  466. endchar;
  467.  
  468. beginchar(incr nextchar,charsize#,charsize#,0cm#);
  469.         xscal:=1;
  470.         CenterRot(0);
  471.         pickup pencircle scaled penwid;
  472.         sec(5);
  473.         draw (.5u,0)--(.5u,.5v)--(4.5u,.5v)--(4.5u,4.5v)--(1.5u,4.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(3.5u,3.5v)--(3.5u,1.5v)--(.5u,1.5v)--(.5u,5v);
  474. endchar;
  475.  
  476. end;
  477.  
  478. ə